package com.ymttest.database.sqlwapper;

import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.CS_ReturnApplyBill;
import com.ymttest.database.model.CS_ReturnApplyProducts;
import com.ymttest.utils.EnvSetup;

public class CS_ReturnApplyProductsWapper {
	SqlManager manager;

    public CS_ReturnApplyProductsWapper() {
        manager = new SqlManager("ymtCS" + EnvSetup.getEnv());
    }

    public CS_ReturnApplyProducts selectByPrimaryKey(String ReturnApplyBillId) {
    	CS_ReturnApplyProducts model=new CS_ReturnApplyProducts();
        List<CS_ReturnApplyProducts> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.CS_ReturnApplyProductsMapper.selectByPrimaryKey",
                        ReturnApplyBillId);
        if(result.size()>0)
        	model=result.get(0);
        manager.commit();
        return model;
    }

    
    public List<CS_ReturnApplyProducts> selectByApplyBillId(String ReturnApplyBillId) {
    	CS_ReturnApplyProducts model=new CS_ReturnApplyProducts();
        List<CS_ReturnApplyProducts> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.CS_ReturnApplyProductsMapper.selectByApplyBillId",
                        ReturnApplyBillId);
        manager.commit();
        return result;
    }
    
    
    public int updateByPrimaryKeySelective(CS_ReturnApplyProducts record) {
    	CS_ReturnApplyProducts model=new CS_ReturnApplyProducts();
        int result = manager
                .update(
                        "com.ymttest.database.mapping.CS_ReturnApplyProductsMapper.updateByPrimaryKeySelective",
                        record);
        manager.commit();
        return result;
    }
    
    
    
    public List<CS_ReturnApplyProducts> selectByOrderId(long orderId) {
        List<CS_ReturnApplyProducts> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.CS_ReturnApplyProductsMapper.selectByOrderId",
                        orderId);
        manager.commit();
        return result;
    }
    
    public CS_ReturnApplyProducts selectByCatalogId(String catalogId) {
    	CS_ReturnApplyProducts model=new CS_ReturnApplyProducts();
        List<CS_ReturnApplyProducts> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.CS_ReturnApplyProductsMapper.selectByCatalogId",
                        catalogId);
        if(result.size()>0)
        	model=result.get(0);
        manager.commit();
        return model;
    }
    public static void main(String[] args) {
    	CS_ReturnApplyProductsWapper test = new CS_ReturnApplyProductsWapper();

        System.out.println(test.selectByPrimaryKey("TH180613000006136").getCatalogId());
        // test.insertYmtCouponSetting(3,11);
        // Logger.debug(test.getLastYmtCouponSettingId());


    }
}
